package com.hejia.alauda.entity;

import static org.springframework.util.CollectionUtils.isEmpty;
import static com.hejia.alauda.entity.Award.*;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Pool implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2193730838031282089L;
	
	private List<Award> pool;
	
	public Pool() {
		super();
		this.pool = new ArrayList<Award>();
	}
	
	public void addAward(Award award) {
		pool.add(award);
	}
	
	public Award getRandomAward() {
		if(!isEmpty(pool)){
			for(int i = 0;i < 50;i++) {
				Collections.shuffle(pool);
			}
			return pool.get(0);
		}
		return THANKS;
	}
	
	public List<Award> getPool(){
		return this.pool;
	}
}
